package com.moive.news.tqnewsapplication.adapter;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.FragmentStatePagerAdapter;

import com.moive.news.tqnewsapplication.base.BaseFragment;
import com.moive.news.tqnewsapplication.entity.Channel;
import java.util.List;

/**
 * Created by Administrator on 2017/12/7.
 */

public class ChannelPagerAdapter extends FragmentStatePagerAdapter {
    private final FragmentManager mFm;
    private List<BaseFragment> fragments;
    private List<Channel> mChannels;
    public ChannelPagerAdapter(FragmentManager fm, List<BaseFragment> fragments, List<Channel> channels) {
        super(fm);
        mFm = fm;
        this.fragments = fragments;
        this.mChannels = channels;
    }
    @Override
    public BaseFragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return mChannels.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mChannels == null ? "" : mChannels.get(position).Title;
    }
    @Override
    public int getItemPosition(Object object) {
        return POSITION_NONE;
    }
}
